home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual Basic 5 / Mastering Microsoft Visual Basic 5.ISO / demo code / ch11 / wininet / frmremotedir.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-10-31  |  4.9 KB  |  145 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmRemoteDir 
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   4950
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7515
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4950
  11.    ScaleWidth      =   7515
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin ComctlLib.Toolbar tbRemoteDir 
  14.       Align           =   1  'Align Top
  15.       Height          =   420
  16.       Left            =   0
  17.       TabIndex        =   3
  18.       Top             =   0
  19.       Width           =   7515
  20.       _ExtentX        =   13256
  21.       _ExtentY        =   741
  22.       Appearance      =   1
  23.       MouseIcon       =   "frmRemoteDir.frx":0000
  24.    End
  25.    Begin ComctlLib.ListView lvRemoteDir 
  26.       Height          =   3825
  27.       Left            =   1830
  28.       TabIndex        =   0
  29.       Top             =   480
  30.       Width           =   4515
  31.       _ExtentX        =   7964
  32.       _ExtentY        =   6747
  33.       LabelWrap       =   -1  'True
  34.       HideSelection   =   -1  'True
  35.       ForeColor       =   -2147483640
  36.       BackColor       =   -2147483643
  37.       BorderStyle     =   1
  38.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  39.          Name            =   "MS Sans Serif"
  40.          Size            =   8.25
  41.          Charset         =   0
  42.          Weight          =   400
  43.          Underline       =   0   'False
  44.          Italic          =   0   'False
  45.          Strikethrough   =   0   'False
  46.       EndProperty
  47.       MouseIcon       =   "frmRemoteDir.frx":001C
  48.       NumItems        =   0
  49.    End
  50.    Begin ComctlLib.StatusBar sbRemoteDir 
  51.       Align           =   2  'Align Bottom
  52.       Height          =   315
  53.       Left            =   0
  54.       TabIndex        =   1
  55.       Top             =   4635
  56.       Width           =   7515
  57.       _ExtentX        =   13256
  58.       _ExtentY        =   556
  59.       SimpleText      =   ""
  60.       BeginProperty Panels {2C787A51-E01C-11CF-8E74-00A0C90F26F8} 
  61.          NumPanels       =   1
  62.          BeginProperty Panel1 {2C787A53-E01C-11CF-8E74-00A0C90F26F8} 
  63.             Object.Width           =   2540
  64.             MinWidth        =   2540
  65.             TextSave        =   ""
  66.             Key             =   ""
  67.             Object.Tag             =   ""
  68.          EndProperty
  69.       EndProperty
  70.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  71.          Name            =   "MS Sans Serif"
  72.          Size            =   8.25
  73.          Charset         =   0
  74.          Weight          =   400
  75.          Underline       =   0   'False
  76.          Italic          =   0   'False
  77.          Strikethrough   =   0   'False
  78.       EndProperty
  79.       MouseIcon       =   "frmRemoteDir.frx":0038
  80.    End
  81.    Begin ComctlLib.TreeView tvRemoteDir 
  82.       Height          =   3765
  83.       Left            =   120
  84.       TabIndex        =   2
  85.       Top             =   540
  86.       Width           =   1425
  87.       _ExtentX        =   2514
  88.       _ExtentY        =   6641
  89.       Style           =   7
  90.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  91.          Name            =   "MS Sans Serif"
  92.          Size            =   8.25
  93.          Charset         =   0
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       MouseIcon       =   "frmRemoteDir.frx":0054
  100.    End
  101. Attribute VB_Name = "frmRemoteDir"
  102. Attribute VB_GlobalNameSpace = False
  103. Attribute VB_Creatable = False
  104. Attribute VB_PredeclaredId = True
  105. Attribute VB_Exposed = False
  106. Option Explicit
  107. Private iNetConnection As iNet
  108. Private Sub Form_Load()
  109.   Set iNetConnection = frmMain.Inet1
  110.   GetRemoteDirectory
  111. End Sub
  112. Private Sub Form_Resize()
  113.   ' Resize the treeview and listview
  114.   tvRemoteDir.Move 0, 0, tvRemoteDir.Width, ScaleHeight
  115.   lvRemoteDir.Move 0, tvRemoteDir.Width, _
  116.     ScaleWidth - tvRemoteDir.Width, ScaleHeight
  117. End Sub
  118. Private Sub Form_Unload(Cancel As Integer)
  119.   ' The following is NOT required but good practice to ensure that the object
  120.   ' reference count is properly decremented.
  121.   Set iNetConnection = Nothing
  122. End Sub
  123. Private Sub GetRemoteDirectory()
  124.   Dim s As String
  125.   Dim p As Long
  126.   ' Validate the Internet connection object
  127.   If Not IsObject(iNetConnection) Then
  128.     MsgBox "No Internet Connection exists"
  129.     Exit Sub
  130.   End If
  131.   If iNetConnection.RemoteHost = "" Then
  132.     iNetConnection.RemoteHost = InputBox$("Enter a remote machine")
  133.       If iNetConnection.RemoteHost = "" Then
  134.         MsgBox "Directory view cancelled"
  135.         Unload Me
  136.       End If
  137.   End If
  138.   p = iNetConnection.Protocol
  139.   iNetConnection.Protocol = icFTP   ' Temporarily set protocol to FTP
  140.   iNetConnection.Execute , "DIR"    ' Execute an FTP DIR command
  141.   s = iNetConnection.GetChunk(1000)
  142.   iNetConnection.Protocol = p       ' Reset the protocol
  143.   Stop
  144. End Sub
  145.